package com.hackerrank.challenges.icecreamparlor;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Solution {
	private static class Item {
		int i, c;
		public Item(int i, int c) {
			this.i = i;
			this.c = c;
		}
		public String toString() {
			return "{" + i + ", " + c + "}";
		}
	}
	private static class ItemComparator implements Comparator<Item> {
		@Override
		public int compare(Item item0, Item item1) {
			return item0.c - item1.c;
		}
		
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int T = in.nextInt();
		ItemComparator itc = new ItemComparator();
		for(int t = 0; t < T; t++) {
			int C = in.nextInt(), N = in.nextInt();
			Item item[] = new Item[N];
			for(int i = 0; i < N; i++)
				item[i] = new Item(i, in.nextInt());
			Arrays.sort(item, itc);
			int l = 0, u = item.length - 1, s = item[l].c + item[u].c;
			while(l <= u && s != C) {
				if(s < C)
					l++;
				else if(s > C)
					u--;
				s = item[l].c + item[u].c;
			}
			System.out.println((Math.min(item[l].i, item[u].i) + 1) + " " + (Math.max(item[l].i, item[u].i) + 1));
		}
	}
}
